import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MiniProgramDomainVO, MiniProgramDomainForm, MiniProgramDomainQuery } from '@/api/platform/miniProgramDomain/types';

/**
 * 查询小程序域名信息列表
 * @param query
 * @returns {*}
 */

export const listMiniProgramDomain = (query?: MiniProgramDomainQuery): AxiosPromise<MiniProgramDomainVO[]> => {
  return request({
    url: '/platform/miniProgramDomain/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询小程序域名信息详细
 * @param id
 */
export const getMiniProgramDomain = (id: string | number): AxiosPromise<MiniProgramDomainVO> => {
  return request({
    url: '/platform/miniProgramDomain/' + id,
    method: 'get'
  });
};

/**
 * 新增小程序域名信息
 * @param data
 */
export const addMiniProgramDomain = (data: MiniProgramDomainForm) => {
  return request({
    url: '/platform/miniProgramDomain',
    method: 'post',
    data: data
  });
};

/**
 * 修改小程序域名信息
 * @param data
 */
export const updateMiniProgramDomain = (data: MiniProgramDomainForm) => {
  return request({
    url: '/platform/miniProgramDomain',
    method: 'put',
    data: data
  });
};

/**
 * 删除小程序域名信息
 * @param id
 */
export const delMiniProgramDomain = (id: string | number | Array<string | number>) => {
  return request({
    url: '/platform/miniProgramDomain/' + id,
    method: 'delete'
  });
};
